Skip to content

feat(config): add shell to watch_files run#9810

Merged
jdx merged 6 commits into
jdx:mainfrom
risu729:feat/watch-files-shell
May 14, 2026
Merged

feat(config): add shell to watch_files run#9810
jdx merged 6 commits into
jdx:mainfrom
risu729:feat/watch-files-shell

Conversation

@risu729

@risu729 risu729 commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add optional shell support for [[watch_files]] entries that use run
  • render shell through config templates and fall back to the configured default inline shell args when unset
  • update docs/schema and add an e2e for fallback and override behavior

Testing

  • cargo fmt --check
  • jq empty schema/mise.json
  • mise run test:e2e config/test_watch_files_shell
  • Not completed locally: mise run test:unit was stopped while still queued behind the shared Cargo wrapper semaphore; CI will run the full suite.

This PR was generated by an AI coding assistant.

@greptile-apps

greptile-apps Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds an optional shell field to [[watch_files]] entries that use run, letting users override the inline shell on a per-entry basis while falling back to the globally configured unix_default_inline_shell_args / windows_default_inline_shell_args when unset.

  • src/watch_files.rs: WatchFile gains a shell: Option<String> field; execute() now accepts it, parses it with shell_words::split, and a new warning fires when shell is set alongside task. This also fixes a latent panic: the old shell[0] index access is replaced by a safe split_first().ok_or_else(…).
  • schema/mise.json: unevaluatedProperties: false is moved inside each oneOf branch so schema validators correctly reject shell on task-based entries.
  • Tests and docs: a new e2e script exercises both the fallback and override paths; the schema e2e adds a negative fixture for task + shell; and docs/hooks.md is updated with an example.

Confidence Score: 5/5

Safe to merge — the change is well-scoped, correctly falls back to the existing default shell, and the previous silent-ignore of shell with task is now warned about both at runtime and rejected by the schema.

All three layers (runtime warning, schema enforcement, e2e tests) are in place. The refactor from shell[0] to split_first() is strictly an improvement, and template rendering of the new field is consistent with the existing run/task handling.

No files require special attention.

Important Files Changed

Filename Overview
src/watch_files.rs Adds optional shell field to WatchFile, passes it into execute(), uses shell_words::split for parsing, and adds a warning when shell + task are set together. Also fixes a latent panic by replacing shell[0] with split_first().ok_or_else().
src/config/config_file/mise_toml.rs Adds template rendering for the new shell field, consistent with how run and task are already handled.
schema/mise.json Restructures watch_files schema: moves unevaluatedProperties: false inside each oneOf branch so shell is only allowed in the run variant, correctly preventing task + shell combinations at schema-validation time.
e2e/config/test_watch_files_shell New e2e test that validates both the fallback shell and the explicit per-entry shell override paths through live mise hook-env invocations.
e2e/config/test_schema_tombi Adds a valid watch_files entry with shell to the positive fixture and a task + shell entry to the negative fixture, exercising the new schema constraints.
docs/hooks.md Adds documentation for the new shell field, including the fallback to the global inline shell settings and a TOML example.

Reviews (6): Last reviewed commit: "Merge branch 'main' into feat/watch-file..." | Re-trigger Greptile

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a shell option for watch_files hooks, allowing users to specify a custom inline shell command instead of relying on the default. The changes include updates to the documentation, JSON schema, configuration parsing, and the execution logic in src/watch_files.rs, supported by a new end-to-end test. Feedback was provided regarding the eager evaluation of the default shell in the execute function, suggesting an optimization to avoid unnecessary overhead when a custom shell is already defined.

Comment thread src/watch_files.rs Outdated
@risu729

This comment was marked as outdated.

@risu729 risu729 marked this pull request as ready for review May 14, 2026 14:33
@jdx jdx merged commit 7adb8bb into jdx:main May 14, 2026
33 checks passed
@risu729 risu729 deleted the feat/watch-files-shell branch May 14, 2026 20:48
mise-en-dev added a commit that referenced this pull request May 15, 2026
### 🚀 Features

- **(config)** add shell to watch_files run by @risu729 in
[#9810](#9810)
- **(spm)** add artifact bundle support by @ikesyo in
[#9825](#9825)

### 🐛 Bug Fixes

- **(aqua)** reject registry-invalid latest tags by @risu729 in
[#9834](#9834)
- **(patrons)** point sponsor link to https://en.dev by @jdx in
[#9868](#9868)
- **(vfox)** respect default inline shell in cmd.exec by @risu729 in
[#9837](#9837)
- github oauth device flow paths by @jasisk in
[#9791](#9791)

### 📚 Documentation

- Update Walkthrough guide by @thernstig in
[#9853](#9853)

### ⚡ Performance

- **(config)** skip tera render for plain strings by @risu729 in
[#9833](#9833)

### 📦️ Dependency Updates

- update ghcr.io/jdx/mise:rpm docker digest to d2471f2 by @renovate[bot]
in [#9879](#9879)
- update rust docker digest to 5b1e348 by @renovate[bot] in
[#9880](#9880)
- update ghcr.io/jdx/mise:deb docker digest to 0cde829 by @renovate[bot]
in [#9878](#9878)
- update ubuntu docker tag to resolute-20260421 by @renovate[bot] in
[#9881](#9881)
- update ghcr.io/jdx/mise:alpine docker digest to 2d0ea74 by
@renovate[bot] in [#9877](#9877)
- update rust crate phf to 0.13 by @renovate[bot] in
[#9884](#9884)
- update rust crate phf_codegen to 0.13 by @renovate[bot] in
[#9883](#9883)

### 📦 Registry

- use aqua backend for npm by @risu729 in
[#9762](#9762)
- add aqua for buck2 prereleases by @risu729 in
[#9805](#9805)
- add SonarQube CLI
([aqua:SonarSource/sonarqube-cli](https://github.com/SonarSource/sonarqube-cli))
by @3PeatVR in [#9824](#9824)

### New Contributors

- @3PeatVR made their first contribution in
[#9824](#9824)
- @ikesyo made their first contribution in
[#9825](#9825)
- @thernstig made their first contribution in
[#9853](#9853)

## 📦 Aqua Registry Updates

### New Packages (4)

- [`SurgeDM/Surge`](https://github.com/SurgeDM/Surge)
- [`roie/ovw`](https://github.com/roie/ovw)
- [`so-dang-cool/sigi`](https://github.com/so-dang-cool/sigi)
- [`vjeantet/alerter`](https://github.com/vjeantet/alerter)

### Updated Packages (2)

-
[`alltuner/mise-completions-sync`](https://github.com/alltuner/mise-completions-sync)
-
[`str4d/age-plugin-yubikey`](https://github.com/str4d/age-plugin-yubikey)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants